package com.it.base.common.view;

import java.io.Serializable;

/**
 * 公共的返回码
 */
public enum ResultCode implements Serializable{
	
	SUCCESS(true,200000,"操作成功"),

	////////////////////////////////////公用异常编码 //////////////////////////
	//前端可以使用的
	E_100101(100101,"传入参数与接口不匹配"),
	E_100102(100102,"验证码错误"),
	E_100103(100103,"验证码为空"),
	E_100104(100104,"查询结果为空"),
	E_100105(100105,"ID格式不正确或超出Long存储范围"),
	E_100106(100106,"上传错误"),
	E_100107(100107,"发送验证码错误"),
	E_100108(100108,"传入对象为空"),
	E_100109(100109,"手机号格式不正确"),
	E_100110(100110,"用户名为空"),
	E_100111(100111,"密码为空"),
	E_100112(100112,"手机号为空"),
	E_100113(100113,"手机号已存在"),
	E_100114(100114,"用户名已存在"),
	E_100115(100115,"密码不正确"),
	E_100116(100116,"存在该记录"),
	E_100117(100117,"用户不存在"),
	E_100118(100118,"用户名或密码错误"),
	E_100119(100119,"表单重复提交"),
	E_100120(100120,"时间格式不正确"),
	E_100121(100121,"名称已存在"),
	E_100122(100122,"上传文件格式不正确"),
	E_100123(100123,"已操作"),
	E_100124(100124,"已预约"),
	E_100125(100125,"存在下级部门,不允许删除"),
	E_100126(100126,"上级部门不能是自己"),
	E_100127(100127,"部门名称已存在"),
	E_1001128(1001128,"用户名不存在"),
	//1999999自定义异常中
	
	 E_1999999(1999999,"自定义"),
	
	//调试用的
	E_300001(300001,"sql语句错误"),
	E_300002(300002,"json格式入参解析错误"),
	E_300003(300003,"认证服务出错"),
	E_300004(300004,"授权服务出错"),
	E_300005(300005,"网络错误"),
	E_300006(300006,"未登录"),
	E_300007(300007,"非网格管理员用户"),
	//
	E_400001(400001,"token失效，请重新登录"),

	////////////////////////////////////特殊异常编码/////////////////////////////////////
    E_999901(999901,"调用微服务-授权服务 被熔断"),
    E_999902(999902,"调用微服务-用户服务 被熔断"),
    E_999903(999903,"调用微服务-资源服务 被熔断"),
    E_999904(999904,"调用微服务-同步服务 被熔断"),

    E_999998(999998,"调用微服务-失败"),
    E_999999(999999,"调用微服务-被熔断"),

	E_NO_AUTHORITY(999997,"没有访问权限"),
	CUSTOM(999998,"自定义异常"),
	/**
	 * 未知错误
	 */
	UNKNOWN(999999,"系统错误");

	// 操作是否成功
	boolean flag = false;
	// 操作代码
	int code;
	// 提示信息
	String message;

	ResultCode(boolean flag, int code, String message) {
		this.flag = flag;
		this.code = code;
		this.message = message;
	}

	ResultCode(int code, String message) {
		this(false, code, message);
	}
	
	ResultCode(String message) {
		this(false, 999998, message);
	}

	public boolean flag() {
		return flag;
	}

	public int code() {
		return code;
	}

	public String message() {
		return message;
	}

	public boolean isFlag() {
		return flag;
	}

	public void setFlag(boolean flag) {
		this.flag = flag;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}
	
	

}
